1 <?php
2 session_start();

3 if
(!isset($_SESSION[custid]))
4 {
5     header(
"Location: registration.php");
6 }
7 include(
"header.php");
8 include(
"sidebar.php");
9 include(
"dbconnection.php");
10
11 ?>
12 <script type=
"text/javascript">
13 function isNumberKey(evt)
14       {
15
16          
var charCode = (evt.which) ? evt.which : event.keyCode
17         
//alert(charCode);
18          
if (charCode > 63 && charCode < 92 )
19          {
20          
return true;
21      }
22      
else if (charCode > 96 && charCode < 123 )
23          {
24          
return true;
25      }
26      
else
27      {
28                              alert(
"should be alphabet");
29         
return false;
30      }
31      }
32 function validate()
33 {

34 if
(document.form1.custname.value=="")
35 {
36     alert(
"Enter Customer Name");
37     document.form1.custname.focus();
38     
return false;
39 }

40 if
(document.form1.custemailid.value=="")
41 {
42     alert(
"Enter the Email ID");
43     document.form1.custemailid.focus();
44     
return false;
45 }

46 if
(document.form1.contactno.value=="")
47 {
48     alert(
"Enter the Contact Number");
49     document.form1.contactno.focus();
50     
return false;
51 }

52 if
(document.form1.vehname.value=="")
53 {
54     alert(
"Enter Vehicle Name");
55     document.form1.vehname.focus();
56     
return false;
57 }

58 if
(document.form1.vehicleno.value=="")
59 {
60     alert(
"Enter Vehicle Numnber");
61     document.form1.vehicleno.focus();
62     
return false;
63 }

64 if
(document.form1.address.value=="")
65 {
66     alert(
"Enter the Address");
67     document.form1.address.focus();
68     
return false;
69 }

70 if
(document.form1.city.value=="")
71 {
72     alert(
"Enter the City");
73     document.form1.city.focus();
74     
return false;
75 }

76 if
(document.form1.landmark.value=="")
77 {
78     alert(
"Enter the Landmark");
79     document.form1.landmark.focus();
80     
return false;
81 }

82 if
(document.form1.zip.value=="")
83 {
84     alert(
"Enter the Zip Code");
85     document.form1.zip.focus();
86     
return false;
87 }
88
89
90 }
91 </script>
92 <?php

93 if
(isset($_SESSION[empid]))
94 {
95 header(
"Location: empaccount.php");
96 }
97
98 $result = mysql_query(
"SELECT * FROM customer where custid='$_SESSION[custid]'");
99 $row = mysql_fetch_array($result);

100
101
102 if
(isset($_POST["submit"]))
103 {

104 /*$dt = date(
"Y-m-d");
105   $sql =
"insert into customer(fname ,emailid,contactno1,createddate) values('$_POST[custname]','$_POST[custemailid]','$_POST[contactno]','$dt')";
106   
if (!mysql_query($sql,$con))
107   {
108   die(
'Error: ' . mysql_error());
109   }
110 $insid = mysql_insert_id();
111 */

112 $dt= date(
"Y-m-d");
113 $sql =
"insert into service(custid,vehiclename,vehicleno,date,address,city,landmark,zipcode,status) values('$_SESSION[custid]','$_POST[vehname]','$_POST[vehicleno]','$dt','$_POST[address]','$_POST[city]','$_POST[landmark]','$_POST[zip]','Pending')";
114
115 if
(!mysql_query($sql,$con))
116   {
117   die(
'Error: ' . mysql_error());
118   }
119
120 }
121 ?>
122
123
124
125         <div id=
"main">
126
127             <a name=
"TemplateInfo"></a>
128             <h1>Vehicle service</h1>
129         <form id=
"form1" name="form1" method="post" action="" onsubmit="return validate()">
130             <?php

131
132 if
(isset($_POST["submit"]))
133 {
134     echo
"<h4><center>Vehicle service request sent successfully...</center></h4>";
135 }

136 else

137 {
138             ?>
139           <table width=
"563" border="0">
140               <tr>
141                 <th width=
"266" height="33" scope="row">Customer Name</th>
142                 <td width=
"287">
143                   <label
for="fname"></label>
144                   <label
for="custname"></label>
145                 <input name=
"custname" type="text" id="custname" onKeyPress="return isNumberKey(event)" value="<?php echo $row[fname]. " ".$row[lname]; ?>" size="35" readonly="readonly"/></td>
146               </tr>
147               <tr>
148                 <th height=
"37" scope="row">Email ID</th>
149                 <td><input type=
"text" name="custemailid" id="custemailid" value="<?php echo $row[emailid]; ?>" size="35" readonly="readonly" /></td>
150               </tr>
151               <tr>
152                 <th height=
"37" scope="row">Contact No.</th>
153                 <td><input name=
"contactno" type="text" id="contactno" onKeypress="if (event.keyCode < 45 || event.keyCode > 57) event.returnValue = false;" value="<?php echo $row[contactno1]; ?>" size="35" ></td>
154               </tr>
155               <tr>
156                 <th height=
"37" scope="row">Vehicle Name
157                   <label
for="lname"></label></th>
158                 <td><label
for="vehname"></label>
159                 <input type=
"text" name="vehname" id="vehname" size="35" /></td>
160               </tr>
161               <tr>
162                 <th height=
"36" scope="row">Vehicle No
163                   <label
for="lname2"></label></th>
164                 <td><label
for="email"></label>
165                   <label
for="model"></label>
166                   <label
for="vehicleno"></label>
167                 <!--input type=
"text" name="vehicleno" id="vehicleno" onKeypress="if (event.keyCode < 45 || event.keyCode > 57) event.returnValue = false;" size="35" /></td-->
168                 <input type=
"text" name="vehicleno" id="vehicleno" onKeypress="" size="35" /></td>
169               </tr>
170               <tr>
171                 <th height=
"40" scope="row">Address</th>
172                 <td><label
for="confpass"></label>
173                   <label
for="images"></label>
174                   <label
for="address"></label>
175                 <textarea name=
"address" id="address"></textarea></td>
176               </tr>
177               <tr>
178                 <th height=
"37" scope="row">City</th>
179                 <td><label
for="phone"></label>
180                   <label
for="estdprice"></label>
181                   <label
for="city"></label>
182                 <input type=
"text" name="city" id="city" size="35"/></td>
183               </tr>
184               <tr>
185                 <th height=
"37" scope="row">Landmark</th>
186                 <td><label
for="mobile"></label>
187                   <label
for="other"></label>
188                   <label
for="landmark"></label>
189                 <input type=
"text" name="landmark" id="landmark" size="35"/></td>
190               </tr>
191               <tr>
192                 <th height=
"35" scope="row">Zipcode</th>
193                 <td><input type=
"text" name="zip" id="zip" onKeypress="if (event.keyCode < 45 || event.keyCode > 57) event.returnValue = false;" size="35" /></td>
194               </tr>
195               <tr>
196                 <th scope=
"row">&nbsp;</th>
197                 <td><label
for="status"></label></td>
198               </tr>
199               <tr>
200                 <th scope=
"row">&nbsp;</th>
201                 <td><input type=
"submit" name="submit" id="submit" value="Request to vehicle service" /></td>
202               </tr>
203           </table>
204           <?php
205 }
206
207 ?>
208 </form>
209             <p>&nbsp;</p>
210 <br />
211
212         </div>
213
214 <!-- wrap ends here -->
215 </div>
216
217 <?php
218 include(
"footer.php");
219 ?>


Gõ tìm kiếm nhanh...